<!doctype html>
<html class="no-js " lang="en">
<head>
<meta charset="utf-8">

	<include file="Public/static" />
</head>

<body id="falcon" class="main_Wrapper">

	<!--  Application Content  -->
	<div id="wrap" class="animsition">

		<!-- 头部 -->
        <include file="Public/header" />
        <!--/ 头部结束  -->

		<!-- CONTROLS Content -->
		<include file="Public/menu" />
		<!--/ CONTROLS Content -->

		<!--  CONTENT  -->
		<section id="content">
			<div class="page page-tables-footable">
				<!-- bradcome -->
				<div class="b-b mb-10">
					<div class="row">
						<div class="col-sm-6 col-xs-12">
							<h1 class="h3 m-0">卡密管理</h1>
							<small class="text-muted">卡密列表</small>
						</div>
					</div>
				</div>

				<!-- row -->
				<div class="row">
					<div class="col-md-12">
						<section class="boxs ">
							<div class="boxs-header">
								<h3 class="custom-font hb-cyan">
									<strong>卡密列表</strong> </h3>
                                    
							</div>
                            <div class="ripple-container">
                                
                            </div>
							<div class="boxs-body">
                            <a href="{:U('user/txt')}?type=1" class="btn btn-raised btn-default">导出所有   </a>
                            <a href="{:U('user/txt')}?type=11" class="btn btn-raised btn-info">导出所有月卡   </a>
                            <a href="{:U('user/txt')}?type=12" class="btn btn-raised btn-primary">导出所有年卡   </a>
                            <a href="{:U('user/txt')}?type=21" class="btn btn-raised btn-info">导出所有未使用月卡   </a>
                            <a href="{:U('user/txt')}?type=22" class="btn btn-raised btn-primary">导出所有未使用年卡   </a>
                            <a onClick="ty_delall(this,'3')" class="btn btn-raised btn-success">删除所有已用卡密   </a>
								<div class="form-group">
									<label for="filter" style="padding-top: 5px">搜索:</label>
									<input id="filter" type="text" class="form-control rounded w-md mb-10 inline-block" />
								</div>
								<table id="searchTextResults" data-filter="#filter" data-page-size="5" class="footable table table-custom">
									<thead>
										<tr>
                                            <th>ID</th>
											<th>卡号</th>
                                            <th>方式</th>
											<th>是否使用</th>
                                           
											<th data-hide='phone, tablet'>操作</th>
										</tr>
									</thead>
									<tbody>
                                        <volist name="list" id="vo">
										<tr>
                                            <td>{$vo.id}</td>
											<td>{$vo.viptext}</td>
                                            <td>
                                                <eq name="vo.type" value="1">
                                                <!-- <button class="btn btn-raised btn-info btn-xs">正常</button> -->
                                                <span class="label label-info">月卡</span>
                                                </eq>
                                                <eq name="vo.type" value="2">
                                                <!-- <button class="btn btn-raised btn-primary btn-xs">禁用</div></button> -->
                                                <span class="label label-primary">年卡</span>
                                                </eq>
                                            </td>
											<td>
                                                <eq name="vo.status" value="0">
                                                <!-- <button class="btn btn-raised btn-info btn-xs">正常</button> -->
                                                <span class="label label-info">未使用</span>
                                                </eq>
                                                <eq name="vo.status" value="1">
                                                <!-- <button class="btn btn-raised btn-primary btn-xs">禁用</div></button> -->
                                                <span class="label label-denger">已使用</span>
                                                </eq>
                                            </td>
											
											<td>
                                                
                                                <a onClick="ty_del(this,'{$vo.id}')" class="label label-warning">删除</a>
                                                
                                            </td>
										</tr>
										</volist>
									</tbody>
									<tfoot class="hide-if-no-paging">
										<tr>
											<td colspan="5" class="text-right">
												<ul class="pagination">
												</ul>
											</td>
										</tr>
									</tfoot>
								</table>
							</div>
						</section>
					</div>
				</div>
			</div>
		</section>
		<!--/ CONTENT -->

	</div>
	<!--/ Application Content -->

<include file="Public/footer" />

	<!--  Page Specific Scripts  -->
	<script >
		$(window).load(function () {
			$('.footable').footable();
		});
	</script>
    <script type="text/javascript">
        function ty_del(obj, id) {
            var id = id;
            layer.confirm('确认要删除该卡密吗？', function (index) {

                $.ajax({
                    type: 'POST',
                    url: '{:U('user/kmdel')}',
                    dataType: 'json',
                    data: { id: id },
                    success: function (data) {
                        console.log(data);
                        if (data.status == '1') {
                            layer.msg(data.info);//layer.msg('不开心。。', {icon: 5});
                            window.location.reload();
                        } else {
                            layer.msg(data.info);
                        }
                    },
                    error: function (data) {
                        layer.msg('删除失败!');
                    },
                });
            });
        }
        
        //启用
        function ty_delall(obj, id) {
            var id = id;
            layer.confirm('确认删除所有已用卡密吗？注意该操作不可逆', function (index) {

                $.ajax({
                    type: 'POST',
                    url: '{:U('user/kmdelall')}',
                    dataType: 'json',
                    data: { id: id },
                    success: function (data) {
                        console.log(data);
                        if (data.status == '1') {
                            layer.msg(data.info);//layer.msg('不开心。。', {icon: 5});
                            window.location.reload();
                        } else {
                            layer.msg(data.info);
                        }
                    },
                    error: function (data) {
                        layer.msg('设置失败!');
                    },
                });
            });
        }
        
    </script>
</body>
</html>